package com.zyx.concurrentdemo.mytest.c05;

import com.zyx.concurrentdemo.c02basic.util.Sleeper;
import lombok.extern.slf4j.Slf4j;

/**
 * @author zyx
 * @since 2021/10/17 08:32
 */
@Slf4j(topic = "c.VolatileDemo")
public class VolatileDemo {
    public static volatile boolean run = true;

    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            while (run) {

            }
            log.debug("线程结束");
        }, "t1");

        t1.start();

        Sleeper.sleep(1);

        run = false;
    }
}
